package com.library.service.impl;

import com.library.common.utils.DateUtils;
import com.library.domain.AppBanner;
import com.library.mapper.AppBannerMapper;
import com.library.service.IAppBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author julyWhj
 * @Description $
 * @Date 2022/3/25 5:03 下午
 **/
@Service
public class AppBannerServiceImpl implements IAppBannerService {
    @Autowired
    private AppBannerMapper appBannerMapper;

    /**
     * 查询banner管理
     *
     * @param bannerId banner管理主键
     * @return banner管理
     */
    @Override
    public AppBanner selectAppBannerByBannerId(Long bannerId) {
        return appBannerMapper.selectAppBannerByBannerId(bannerId);
    }

    /**
     * 查询banner管理列表
     *
     * @param appBanner banner管理
     * @return banner管理
     */
    @Override
    public List<AppBanner> selectAppBannerList(AppBanner appBanner) {
        return appBannerMapper.selectAppBannerList(appBanner);
    }

    /**
     * 新增banner管理
     *
     * @param appBanner banner管理
     * @return 结果
     */
    @Override
    public int insertAppBanner(AppBanner appBanner) {
        appBanner.setCreateTime(DateUtils.getNowDate());
        return appBannerMapper.insertAppBanner(appBanner);
    }

    /**
     * 修改banner管理
     *
     * @param appBanner banner管理
     * @return 结果
     */
    @Override
    public int updateAppBanner(AppBanner appBanner) {
        appBanner.setUpdateTime(DateUtils.getNowDate());
        return appBannerMapper.updateAppBanner(appBanner);
    }

    /**
     * 批量删除banner管理
     *
     * @param bannerIds 需要删除的banner管理主键
     * @return 结果
     */
    @Override
    public int deleteAppBannerByBannerIds(Long[] bannerIds) {
        return appBannerMapper.deleteAppBannerByBannerIds(bannerIds);
    }

    /**
     * 删除banner管理信息
     *
     * @param bannerId banner管理主键
     * @return 结果
     */
    @Override
    public int deleteAppBannerByBannerId(Long bannerId) {
        return appBannerMapper.deleteAppBannerByBannerId(bannerId);
    }
}

